using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace PrjSerails
{
    class DiskTool
    {

        static public void copyFile(string fromFile, string toFile)
        {
            try
            {
                FileStream fileCreate = new FileStream(toFile, FileMode.Create);
                fileCreate.Close();
                fileCreate.Dispose();
                FileStream fromOpen = new FileStream(fromFile, FileMode.Open, FileAccess.Read);
                FileStream toOpen = new FileStream(toFile, FileMode.Append, FileAccess.Write);
                byte[] buffer = new byte[fromOpen.Length];
                fromOpen.Read(buffer, 0, (int)fromOpen.Length);
                fromOpen.Flush();
                toOpen.Write(buffer, 0, (int)fromOpen.Length);
                toOpen.Flush();
                toOpen.Close();
                fromOpen.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
    }
}
